package com.xydtech.ecard.ftp.enums;

/**
 * @Author: liliya
 * @Description: 等额本息下限期限、上限期限与日期的关系
 * @Date: Created in 2023/8/23 17:56
 * @Modified:
 */

public enum FtpUnderUpperDateRelationEnum {

    RELATION_1_1M(1,1,2,"1M","3M"),
    RELATION_1_3M(1,3,5,"3M","6M"),
    RELATION_1_6M(1,6,8,"6M","9M"),
    RELATION_1_9M(1,9,11,"9M","1Y"),
    RELATION_1_1Y(1,12,23,"1Y","2Y"),
    RELATION_1_2Y(1,24,35,"2Y","3Y"),
    RELATION_1_3Y(1,36,59,"3Y","5Y"),
    RELATION_1_5Y(1,60,119,"5Y","10Y"),
    RELATION_1_10Y(1,120,179,"10Y","15Y"),
    RELATION_1_15Y(1,180,239,"15Y","20Y"),
    RELATION_1_20Y(1,240,360,"20Y","30Y"),
    RELATION_1_30Y(1,360,999,"30Y","30Y"),

    RELATION_3_3M(3,1,1,"3M","6M"),
    RELATION_3_6M(3,2,2,"6M","9M"),
    RELATION_3_9M(3,3,3,"9M","1Y"),
    RELATION_3_1Y(3,4,7,"1Y","2Y"),
    RELATION_3_2Y(3,8,11,"2Y","3Y"),
    RELATION_3_3Y(3,12,19,"3Y","5Y"),
    RELATION_3_5Y(3,20,39,"5Y","10Y"),
    RELATION_3_10Y(3,40,59,"10Y","15Y"),
    RELATION_3_15Y(3,60,79,"15Y","20Y"),
    RELATION_3_20Y(3,80,119,"20Y","30Y"),
    RELATION_3_30Y(3,120,999,"30Y","30Y");

    //还款频率(1,3,6,12)(只选1和3)
    private Integer repaymentFrequency;
    //等额本息行号:从第几行开始
    private Integer underNum;
    //等额本息行号:从第几行结束
    private Integer upperNum;
    //等额本息下限标识(用作查询下限标识对应的利率)
    private String configUnderKey;
    //等额本息上限标识(用作查询上限标识对应的利率)
    private String configUpperKey;

    FtpUnderUpperDateRelationEnum(Integer repaymentFrequency, Integer underNum, Integer upperNum, String
            configUnderKey, String configUpperKey) {
        this.repaymentFrequency = repaymentFrequency;
        this.underNum = underNum;
        this.upperNum = upperNum;
        this.configUnderKey = configUnderKey;
        this.configUpperKey = configUpperKey;
    }

    public Integer getRepaymentFrequency() {
        return repaymentFrequency;
    }

    public Integer getUnderNum() {
        return underNum;
    }

    public Integer getUpperNum() {
        return upperNum;
    }

    public String getConfigUnderKey() {
        return configUnderKey;
    }

    public String getConfigUpperKey() {
        return configUpperKey;
    }

    public static FtpUnderUpperDateRelationEnum values(Integer repaymentFrequency, Integer line){
        for(FtpUnderUpperDateRelationEnum enums : FtpUnderUpperDateRelationEnum.values()){
            if(repaymentFrequency == enums.getRepaymentFrequency() && line >= enums.getUnderNum() && line <= enums.getUpperNum()){
                return enums;
            }
        }
        return null;
    }


}
